package io.renren.modules.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.admin.dao.CadesStyleDao;
import io.renren.modules.admin.entity.CadesStyleEntity;
import io.renren.modules.admin.service.CadesStyleService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("cadesStyleService")
public class CadesStyleServiceImpl extends ServiceImpl<CadesStyleDao, CadesStyleEntity> implements CadesStyleService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String type = (String) params.get("type");

        QueryWrapper<CadesStyleEntity> cadesStyleEntityQueryWrapper = new QueryWrapper<>();
        cadesStyleEntityQueryWrapper.eq(StringUtils.isNotBlank(type), "type", type);

        IPage<CadesStyleEntity> page = this.page(new Query<CadesStyleEntity>().getPage(params), cadesStyleEntityQueryWrapper);

        return new PageUtils(page);
    }

}